﻿<template>
    <Modal title="编辑" v-model="modalEdit" @on-visible-change="showModal" :closable="false">
        <el-form ref="productTracking" label-position="right" label-width="120" :model="productTracking" :rules="rules">
            <input type="hidden" :model="productTracking.id" />
           
            <el-form-item label="链接" prop="url">
                <el-input v-model="productTracking.url" placeholder="" style="width: 360px" />
            </el-form-item>
        </el-form>
        <div slot="footer">
            <el-button @click="cancel">取消</el-button>
            <el-button type="primary" :loading="modalLoading" @click="ok">确定</el-button>
        </div>
    </Modal>
    </div>
</template>
<script>
export default {
    name: 'ProductTracking',
    data() {
        return {

            modalEdit: false,
            modalLoading: false,
            productTrackingId: "",
            productTracking: {

            },
            rules: {

            }
        };
    },
    mounted: function() {
       

    },
    methods: {
        cbtime: function(value) {
            this.others;
        },
        showModal(val) {
            if (val) {
                
            } else {
                this.productTracking = {

                }
            }
        },
        showDialog(id) {
            
            this.modalEdit = true;
        },
        ok: function() {
            var ok = false;
            this.$refs['productTracking'].validate((valid) => {
                ok = valid;
                if (valid) {

                } else {
                    this.errorMessage('请认真填写数据');
                }
            })
            if (!ok) return;
            var me = this;

            me.modalLoading = true;
            me.$http.post("/producttracking/doSave.do", me.productTracking).then(response => {
                var body = response;
                if (body.status == 0) {
                    me.successMessage("保存成功！");
                    me.modalEdit = false;
                    me.$emit("ok");

                } else {
                    me.errorMessage( body.info);
                }
                me.modalLoading = false;
            }, response => {
                me.modalLoading = false;
            });
        },
        cancel: function() {
            this.productTracking = {};
            this.modalEdit = false;
            this.$emit("ok");
        }
    }
}
</script>
<style scoped>
</style>